根據上篇,來做一些join語法練習
找出所有employee的名字,部門編號和部門名字
找出有employee deptID符合dpet的deptID
select emp_name,emp.deptID,deptname
from emp,dept
where emp.deptID=dept.deptID
select emp_name,emp.deptID,deptname
from emp join dept
on emp.deptID=dept.deptID;
Non-equal join
select e.emp_name,e.salary,g.job_level
from[dbo].[grade] g,[dbo].[emp] e
where e.salary between g.lowest and g.highest